package com.mall.dto;

import com.mall.entity.OmsOrderItem;
import com.mall.utils.SpDataJsonParser;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

@Data
@EqualsAndHashCode(callSuper = false)
public class FrontOrderItem {

    @ApiModelProperty("id")
    private Long id;

    @ApiModelProperty("订单id")
    private Long orderId;

    @ApiModelProperty("订单编号")
    private String orderSn;

    @ApiModelProperty("商品id")
    private Long productId;

    @ApiModelProperty("商品图片")
    private String productPic;

    @ApiModelProperty("商品名称")
    private String productName;

    @ApiModelProperty("商品品牌")
    private String productBrand;

    @ApiModelProperty("销售价格")
    private BigDecimal productPrice;

    @ApiModelProperty("购买数量")
    private Integer productQuantity;

    @ApiModelProperty("商品的销售属性-json")
    private List<FrontCateAttributeDto> spData;

    public void setOrderItem(OmsOrderItem orderItem) {
        this.id = orderItem.getId();
        this.orderId = orderItem.getOrderId();
        this.orderSn = orderItem.getOrderSn();
        this.productId = orderItem.getProductId();
        this.productPic = orderItem.getProductPic();
        this.productName = orderItem.getProductName();
        this.productBrand = orderItem.getProductBrand();
        this.productPrice = orderItem.getProductPrice();
        this.productQuantity = orderItem.getProductQuantity();
        this.spData = SpDataJsonParser.parse(orderItem.getSpData());
    }
}
